package yxm.zyf.love.service.impl;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.plugin.core.PluginRegistry;
import org.springframework.stereotype.Component;

import lombok.extern.slf4j.Slf4j;
import yxm.zyf.love.domian.PayRequestVO;
import yxm.zyf.love.service.OrderPayOperationService;

@Component
@Slf4j
public class OrderPayService {

    @Resource(name ="orderPayOperationServiceRegistry")
    private PluginRegistry<OrderPayOperationService, PayRequestVO> orderPayOperationServicePluginRegistry;

    public void orderPay(PayRequestVO payRequestVO) {
        //获取插件
        OrderPayOperationService orderPayOperationService = orderPayOperationServicePluginRegistry.getPluginFor(payRequestVO);//getPlugins();
        //发起订单支付
        String orderPay = orderPayOperationService.orderPay(payRequestVO);
        log.info("支付返回:{}", orderPay);
    }

}
